" ------------------------------------------------
" ------------the introduce source ---------------
" ------------------------------------------------
source $HOME/.config/nvim/plug-config/coc.vim


" line number
set nu
set autoindent

set pastetoggle=<F2>

set hlsearch

let mapleader=','
" <cr> enter
inoremap <leader>w <Esc>:w<cr>
noremap <leader>w <Esc>:w<cr>

inoremap <leader>q <Esc>:q<cr>
noremap <leader>q <Esc>:q<cr>

inoremap <leader>x <Esc>:x<cr>
noremap <leader>x <Esc>:x<cr>

" `^ to next write site
inoremap jj <Esc>`^

" exchange buffer
nnoremap <silent> [b :bprevious<cr>
nnoremap <silent> [n :bnext<cr>

" use ctrl +h/j/k/l switch window
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l


call plug#begin('~/.vim/plugged')
" 1.startify
Plug 'mhinz/vim-startify'
" 2. theme 
" Plug 'altercation/vim-colors-solarized'
" 3. airline and theme
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" 4. nerdtree
Plug 'preservim/nerdtree'
" 5. ctrlp
Plug 'ctrlpvim/ctrlp.vim'
" 6. easy motion
Plug 'easymotion/vim-easymotion'
" 7. vim-surround
Plug 'tpope/vim-surround'
" 8. fzf.vim
Plug 'junegunn/fzf.vim'
Plug 'junegunn/fzf', { 'dir': '~/.vim/plugged/fzf', 'do': './install --all' }
" Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" 9.tagbar
Plug 'preservim/tagbar'
" 10. high lighted words
Plug 'lfv89/vim-interestingwords'
" 11. vim-table-model
Plug 'dhruvasagar/vim-table-mode' 
" 12. vim-instant-markdown
Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
" 13. coc.nvim Stable version of coc
Plug 'neoclide/coc.nvim', {'branch': 'release'}

call plug#end()


" -------------------------------------
"  plug config
"  ------------------------------------

" 2.vim-colors-solarize
" syntax enable
" let g:solarized_termcolors=16
" set t_Co=256
" set background=light
" colorscheme solarized
" 
" if has('gui_running')
"     set background=dark
" else
"     set background=light
" endif
" 4.nerdtree
nnoremap <leader>v :NERDTreeFind<cr>
nnoremap <leader>g :NERDTreeToggle<cr>
let NERDTreeShowHidden=1

" 5. ctrlp
" let g:ctrlp_map = '<c-p>'
" 6. easy motion
map ss <Plug>(easymotion-s2)
" 8. fzf config
nnoremap <silent> <Leader>ag :Ag <C-R><C-W><CR>
nnoremap <silent> <c-p> :Files <CR>
" 9. tagbar config
nmap <leader>t :TagbarToggle<CR>
" 12
" let g:instant_markdown_slow = 0
let g:instant_markdown_autostart = 0
" let g:instant_markdown_open_to_the_world = 1
" let g:instant_markdown_allow_unsafe_content = 1
" let g:instant_markdown_allow_external_content = 0
" let g:instant_markdown_mathjax = 1
let g:instant_markdown_autoscroll = 1

inoremap <leader>im <Esc>:InstantMarkdownPreview<cr>
noremap <leader>im <Esc>:InstantMarkdownPreview<cr>

